<template>
  <base-layout>
    <template #searchPanel>
      <search-panel
        v-slot="{ form }"
        :selectPer="'carRecord:page'"
        @search="search"
        :showSearchButton="true"
      >
        <el-input
          v-model="form.vin"
          clearable
          placeholder="车架号/VIN"
          style="width: 200px"
        />
      </search-panel>
    </template>
    <template #contentPanel>
      <data-table
        :value="tableData"
        :total-count="totalCount"
        :has-action="false"
        :table-column-attributes="tableColumnAttributes"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :width="160"
      >
      </data-table>
    </template>
  </base-layout>
</template>
<script>
import baseMixin from '@/mixins/base'
import {
  getPage
} from '@/api/pre-sale/storageManagement'

export default {
  mixins: [
    baseMixin({
      idName: 'id',
      findData: getPage,
      dataName: ['content', 'totalRecords'],
      format(res) {
        return res.map((data) => {
          data.brandlist = data.brandName + '/' + data.seriesName + '/' + data.modelName
          return data
        })
      }
    })
  ],
  data() {
    return {
      tableColumnAttributes: [
        {
          name: '门店',
          value: 'storeName',
          type: 'text'
        },
        {
          name: '仓库',
          value: 'storageName',
          type: 'text'
        },
        {
          name: '仓位',
          value: 'storageSiteName',
          type: 'text'
        },
        {
          name: '操作类型',
          value: 'carRecordType',
          type: 'text'
        },
        {
          name: '车架号',
          value: 'vin',
          type: 'text'
        },
        {
          name: '品牌/车系/车型',
          value: 'brandlist',
          type: 'text'
        },
        {
          name: '车身色',
          value: 'outColor',
          type: 'text'
        }, {
          name: '内饰色',
          value: 'inColor',
          type: 'text'
        },
        {
          name: '状态',
          value: 'status',
          type: 'text'
        },
        {
          name: '结算金额',
          value: 'amount',
          type: 'text'
        },
        {
          name: '操作人',
          value: 'operationUserName',
          type: 'text'
        },
        {
          name: '操作时间',
          value: 'createTime',
          type: 'text'
        }
      ]
    }
  },
  methods: {
    // 查询
    search(form) {
      this.searchOptions = form
      this.currentPage = 1
      this.setTableData()
    }
  },
  async mounted() {

  }
}
</script>
